package net.vkits.anjiamiao.domain;

import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.IdentifierGenerator;

import java.io.Serializable;
import java.time.Instant;

/**
 * Created by ethan-liu on 2016/11/29.
 */
public class IdGenerator implements IdentifierGenerator {
    @Override
    public Serializable generate(SessionImplementor sessionImplementor, Object o) throws HibernateException {
        return String.valueOf(Instant.now().toEpochMilli());
    }
}
